Resolves: #i122984# Avoid too many Print JobSetups...
be more tolerant with last line TIFF imports
(cherry picked from commit 0ab284f5064f66a11741fa4aa2e2774c1d7e5f14)
Change-Id: I75c86422bfbf2f83e1027bbc1bd83260de39b3ca
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index ce70811..1d105b2 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -621,7 +621,7 @@
}
sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTargetBits )
sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTargetBits, bool bLastLine )
{
sal_uInt16 i;
sal_uInt8 * pDst;
@@ -706,6 +706,12 @@
for ( i = 0; i < nLastLineSize; i++ ) *(pDst++)=*(pSrc++);
}
// #i122984#
if( !bStatus && bLastLine )
{
bStatus = sal_True;
}
if ( pIStream->GetError() )
bStatus = sal_False;
diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/filter/source/graphicfilter/itiff/ccidecom.hxx
index db5295ae..e018dcf 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.hxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.hxx
@@ -53,7 +53,7 @@
void StartDecompression( SvStream & rIStream );
sal_Bool DecompressScanline(sal_uInt8 * pTarget, sal_uLong nTargetBits );
sal_Bool DecompressScanline(sal_uInt8 * pTarget, sal_uLong nTargetBits, bool bLastLine );
private:
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 4c2e1fb..dc27652 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -559,7 +559,7 @@
pTIFF->Seek( pStripOffsets[ nStrip ] );
aCCIDecom.StartDecompression( *pTIFF );
}
if ( aCCIDecom.DecompressScanline( pMap[ np ], nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes ) == sal_False )
if ( aCCIDecom.DecompressScanline( pMap[ np ], nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes, np + 1 == nPlanes ) == sal_False )
return sal_False;
if ( pTIFF->GetError() )
return sal_False;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 8e97d4bc..ba69c1c 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1213,11 +1213,25 @@
if ( mbInPrintPage )
return false;
Size aPixSize = LogicToPixel( rSize );
Size aPageSize = PixelToLogic( aPixSize, MAP_100TH_MM );
if ( (maJobSetup.ImplGetConstData()->mePaperFormat != PAPER_USER) ||
(maJobSetup.ImplGetConstData()->mnPaperWidth != aPageSize.Width()) ||
(maJobSetup.ImplGetConstData()->mnPaperHeight != aPageSize.Height()) )
const Size aPixSize = LogicToPixel( rSize );
const Size aPageSize = PixelToLogic( aPixSize, MAP_100TH_MM );
bool bNeedToChange(maJobSetup.ImplGetConstData()->mnPaperWidth != aPageSize.Width() ||
maJobSetup.ImplGetConstData()->mnPaperHeight != aPageSize.Height());
if(!bNeedToChange)
{
// #i122984# only need to change when Paper is different from PAPER_USER and
// the mapped Paper which will created below in the call to ImplFindPaperFormatForUserSize
// and will replace maJobSetup.ImplGetConstData()->mePaperFormat. This leads to
// unnecessary JobSetups, e.g. when printing a multi-page fax, but also with
// normal print
const Paper aPaper = ImplGetPaperFormat(aPageSize.Width(), aPageSize.Height());
bNeedToChange = maJobSetup.ImplGetConstData()->mePaperFormat != PAPER_USER &&
maJobSetup.ImplGetConstData()->mePaperFormat != aPaper;
}
if(bNeedToChange)
{
JobSetup aJobSetup = maJobSetup;
ImplJobSetup* pSetupData = aJobSetup.ImplGetData();